﻿@model Tasks.UI.Models.TourGuide.ManageModel
@{
    Layout = "~/Views/Account/_AccountMaster.cshtml";
}
@section head{
    <style type="text/css">
        /* 搜索栏 div */
        .search
        {
            background: url(/images/inquiry_bgtop.jpg) no-repeat;
            margin-top: 10px;
            margin-bottom: 10px;
            padding: 10px 0px 0px 0px;
        }
        .search table
        {
            padding: 2px;
            width: 100%;
            background: #cbecff url(/images/inquiry_bgbottom.jpg) no-repeat 0 bottom;
        }
    </style>
    <script type="text/javascript">

        $(function () {
            initProvince("#ProvinceID");
            initCity("#CityID");
            initTable(".tblStyle1");
        })

        function setState(tourGuideID, state) {
            $("#TourGuideID").val(tourGuideID);
            goto(state);
        }

        function goto(act) {
            $("#act").val(act);
            document.forms[0].submit();
        }

        //删除数据
        function ConfirmDel(tourGuideID) {
            $.Msg.confirmDelete(
             function () {
                 $("#TourGuideID").val(tourGuideID);
                 $("#act").val("delete");
                 $("form").submit();
             }
        );
        }
    </script>
}
@using (Html.BeginForm())
{
    <input id="act" name="act" type="hidden" />
    <input id="TourGuideID" name="TourGuideID" type="hidden" />
      
    <div class="navTitle">
        <ul>
            <li class="Home SecondLast"><a href="#">
                <div class="HomeIcon">
                </div>
                <font><font>Home</font></font></a></li><li class="Last"><span><font><font>导游管理</font></font></span></li>
        </ul>
    </div>
    <h1>
        <font><font class="">查看所有导游</font></font>
    </h1>
    <p class="intro">
        <font><font>导游资料如下。</font><font
            class="">点击“添加导游”按钮来添加一个新的导游。</font></font>
    </p>
  
    <div class="searchBar">
        <table>
            <tr align="left">
                <td>
                    <strong>姓名:</strong>
                    @Html.TextBoxFor(t => t.Name, new { style = "width:100px;" })
                    @Html.DropDownList("WorkAppraise", PageHelper.WorkAppraiseSelector(0))
                    @Html.DropDownList("WorkTime", PageHelper.WorkTimeSelector(0))
                    @Html.DropDownList("WorkLevel", PageHelper.WorkLevelSelector(0))
                    @Html.DropDownList("Language", PageHelper.GuideLanguage())
                    @Html.DropDownList("ProvinceID", PageHelper.ProvinceSelector(Model.ProvinceID))
                    @Html.DropDownList("CityID", PageHelper.CitySelector(Model.CityID, Model.ProvinceID))
                    @Html.DropDownList("AreaID", PageHelper.AreaSelector(Model.AreaID, Model.CityID))
                    <input id="btnSearch" type="button" value="查询" onclick="goto('search')" class="btnSearch" />
                    <a href="javascript:void(0)" onclick="openTab('添加导游','/Account/TourGuideEdit',true)">
                        添加导游</a>
                </td>
            </tr>
        </table>
        <div class="bottom">
        </div>
    </div>
    <div class="pageBody">
        <table border="0" cellspacing="0" cellpadding="0" class="tblStyle1">
            <thead>
                <tr align="center">
                    <th style="width: 6%">
                        状态
                    </th>
                    <th style="width: 8%">
                        姓名
                    </th>
                    <th style="width: 4%">
                        性别
                    </th>
                    <th style="width: 15%">
                        城市
                    </th>
                    <th style="width: 15%">
                        手机
                    </th>
                    <th style="width: 10%">
                        优先级
                    </th>
                    <th style="width: 10%">
                        评价
                    </th>
                    <th style="width: 10%">
                        类别
                    </th>
                    <th style="width: 10%">
                        等级
                    </th>
                 
                    <th style="width: 12%">
                        操作
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (TourGuide guide in Model.TourGuide)
                {
                    if (guide.Contact == null)
                    {
                        guide.Contact = new ContactInfo();
                    }
                    <tr align="center">
                        <td>
                            @if (guide.State == (int)Tasks.Common.Enum.TourGuideState.无效)
                            {
                                <span>停止</span>
                                      
                            }
                            else
                            {
                                <span>正常</span>
                            }
                        </td>
                        <td>
                           @guide.Name
                        </td>
                        <td>
                            @if (guide.Sex == (int)Tasks.Common.Enum.Sex.男)
                            {
                                <span>男</span>
                                      
                            }
                            else
                            {
                                <span>女</span>
                            }
                        </td>
                        <td>
                            @guide.Contact.Position
                        </td>
                        <td>@guide.Contact.MobileNo
                        </td>
                        <td>@guide.SNO
                        </td>
                        <td>@PageHelper.WorkAppraiseToStr(guide.WorkAppraise)
                        </td>
                        <td>@PageHelper.WorkTimeToStr(Convert.ToInt32(guide.WorkTime))
                        </td>
                        <td>@PageHelper.WorkLevelToStr(guide.WorkLevel)
                        </td>
                      
                        <td>
                            <a href="javascript:void(0)" onclick="openTab('修改导游','/Account/TourGuideEdit?TourGuideID=@guide.TourGuideID',true)">
                                <img src="/images/icon/16x16/file_edit.png"  title="编辑"/></a> <a href="javascript:;" onclick="ConfirmDel(@guide.TourGuideID)" title="删除"><img src="/images/icon/16x16/delete.png" title="删除" /></a>
                            @if (guide.State == (int)Tasks.Common.Enum.TourGuideState.无效)
                            {
                                <a href="javascript:;" onclick="setState(@guide.TourGuideID,'tostart')" title="状态：停用或启用">
                                    <img src="/images/icon/16x16/enable.png" title="启用"/></a>
                            }
                            @if (guide.State == (int)Tasks.Common.Enum.TourGuideState.有效)
                            {
                                <a href="javascript:;" onclick="setState(@guide.TourGuideID,'blockup')" title="状态：停用或启用">
                                    <img src="/images/icon/16x16/stop.png"  title="禁用" /></a>
                            }
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
      
    @Html.RenderPageNav(Model.PageIndex, Model.PageSize, Model.RowCount, "", PageNavStyle.Form)
}
